package com.lize;

import java.util.ArrayList;

public class Generic02 {
    public static void main(String[] args) {
        ArrayList<Dog> list=new ArrayList<Dog>();
        list.add(new Dog("小黄",12));
        list.add(new Dog("小白",10));
        list.add(new Dog("小黑",9));
        for(Dog dog:list){


            System.out.println(dog.getAge());
        }


    }
}
class Dog{
    private String name;
    private int age;

    public Dog(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}